<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html >
  <head>
  	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>添加或修改默认收件人</title>
	<link rel="stylesheet" href="<%=path %>/css/public.css" type="text/css"  />
	<link rel="stylesheet" href="<%=path %>/css/module.css" type="text/css"  />
	<link rel="stylesheet" href="<%=path %>/css/skin_blue.css" type="text/css"  />
	<script type="text/javascript" src="<%=path %>/js/json.js"></script>
	<script type="text/javascript" src="<%=path %>/js/util.js"></script>
	<script type="text/javascript">
		function save(){
			if(getObjById('name').value.length==0 ||getObjById('mail').value.length==0){
				alert('加 * 为必填项，该项值不能为空！');
				return ;
			}
			if(!checkMail(getObjById('mail').value)){
				alert('收件人邮箱格式错误！');
				return ;
			}
			var param={};
			param.id=getObjById('userId').value;
			param.name=getObjById('name').value;
			param.mail=getObjById('mail').value;
			param.description=getObjById('description').value;
			getObjById('requestData').value=Ext.util.JSON.encode(param);
			getObjById('frmReceiverMaintain').submit();
		}
		function init(){
			var obj=Ext.util.JSON.decode(getObjById('responseData').value);
			getObjById('userId').value=obj.id;
			getObjById('name').value=obj.name;
			getObjById('mail').value=obj.mail;
			getObjById('description').value=obj.description;
		}
	</script>
  </head>
  
  <body onload="init();">
    <input type="hidden" id="responseData" value="<s:property value="responseData"/>">
  	<input type="hidden" id="userId" >
  	<form action="<%=path %>/ftp!saveReceiver.action" id="frmReceiverMaintain" enctype="multipart/form-data" method="post">
  		<input type="hidden" id="requestData" name="requestData">
  	</form>
	<div class="tab">
	  <table width="100%"  border="0" class="formlist" cellpadding="0" cellspacing="0">
	    <thead>
	    	<tr>
	        	<th colspan="4"><span>默认收件人信息</span></th>
	        </tr>
	    </thead>
	    <tfoot>
	      <tr>
	        <td colspan="4"><div class="bz">"<span class="red">*</span>"为必填项，如已存在相同的收件人邮箱地址，则进行覆盖！</div>
	          <div class="btn">
	            <button name="btnSave" onclick="save();">保 存</button>
	          </div>
	        </td>
	      </tr>
	    </tfoot>
	    <tbody>
	      <tr>
	        <th><span class="red">*</span>收件人姓名</th>
	        <td><input size="35" class="text_nor" id="name"/></td>
	        <th><span class="red">*</span>收件人邮箱</th>
	        <td><input size="35" class="text_nor" id="mail"/></td>
	      </tr>
	      <tr>
	        <th>备注</th>
	        <td colspan="3"><input size="105" class="text_nor" id="description"/></td>
	      </tr>
	    </tbody>
	  </table>
	</div>
  </body>
</html>
